﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using DAL;
using System.IO;
using ImageConverter;


namespace codeplexInteticsDev
{
    public partial class frmShop : Form
    {
        Context db;
        ImageConv ic;

        public frmShop()
        {
            InitializeComponent();
            db = new Context();
            cmbCategories.SelectedIndex = 0;
            ic = new ImageConv();
            dgvInfoWindow.DataSource = db.Products.ToList<Product>();
        }

        private void btnLoginWindow_Click(object sender, EventArgs e)
        {
            frmLoginPass loginWindow = new frmLoginPass();
            loginWindow.Show();
        }

        private void btnCreateDB_Click(object sender, EventArgs e)
        {
            //foreach (var item in db.Products)
            //{
                
               pboxProductImage.Image = ic.byteArrayToImage(db.Products.First<Product>(p=>p.image!=null).image);
            //}
        }

        private void cmbCategories_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void dgvInfoWindow_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }
    }
}
